{%- assign categories = '计算器|干员与关卡|游戏数据速查|帮助与支持' | split: '|' -%}

<div class="l-layout__sidebar">
  <ul class="l-sidebar">
{%- for category in categories -%}

  {%- if category.size > 0 -%}
    <li class="l-sidebar__item l-sidebar__item--level-0">
      {{ category | default: ''}}
    </li>
  {%- endif -%}
  {%- assign pages = site[page.collection] | sort: 'url' | sort: 'order' -%}
  {%- for item in pages -%}
    {%- if item.category == category and item.parent == nil and item.hide == nil -%}
      {%- assign level = item.order | default: 0 | split: '.' | size -%}
    <li class="l-sidebar__item l-sidebar__item--level-{{level}} {% if page.url == item.url or item.url == page.parent %}l-sidebar__item--active{% endif %}">
      <a class="l-sidebar__link" href="{{ item.url | relative_url }}">
        <i class="l-sidebar__icon fas fa-{{ item.icon | default: item.icon | default: "file" }} fa-fw"></i>
        {%- if item.new -%}
          <strong>
        {%- endif -%}
        {{ item.title }}
        {%- if item.new -%}
          </strong>
        {%- endif -%}
        
      </a>
    </li>
    {%- endif -%}
  {%- endfor -%}

{%- endfor -%}
  </ul>
</div>